define([
    'jquery',
    'underscore',
    'backbone',
    'text!admin/user/list.html',
    'js/myApiAmd'
], function ($, _, Backbone, tpl, myApi) {
    var View = Backbone.View.extend({

        initialize: function () {
            this.tmpl = _.template(tpl);
        },

        onRender: function (qs, callback) {
            var that = this;
            myApi.getAdminList(function (err, res) {
                res = JSON.parse(res);
                $(that.el).html(that.tmpl({admins: res.list}));
                callback(that);
            });
        },

        onReshow: function (qs, callback, forceReload) {
            $(this.el).show();
        },

        hide: function () {
            $(this.el).hide();
        },

        remove: function () {
            $(this.el).remove();
        }
    });

    return View;
});